<html>
<head>
<script src="worker_utils.js"></script>
</head>
<body>
<div id=result></div>
<script>
function log(message)
{
  document.getElementById("result").innerHTML += message + "<br>";
}

var worker = new Worker("worker_common.js");
worker.postMessage("ping");
worker.onmessage = workerStarted;

var sharedWorker;
function workerStarted(event) {
  log ("worker created");
  worker.postMessage("close");
  sharedWorker = new SharedWorker("worker_common.js");
  sharedWorker.port.postMessage("ping");
  sharedWorker.port.onmessage = sharedWorkerStarted;
}

function sharedWorkerStarted(event) {
  log ("shared worker created");
  sharedWorker.port.postMessage("close");
  onSuccess();
}
</script>

</body>
</html>
